using System;
using LatoolNet;

namespace NumericalSolution {
    class TriMatrixDemoMain {
        static void Main() {

            int bandWidth = 3;
            Matrix mat = new Matrix(5, 5, bandWidth);
            Matrix vec = new Matrix(5, 1);

            mat[0, 0] = -5;
            mat[0, 1] = 2;

            mat[1, 0] = 3;
            mat[1, 1] = -2;
            mat[1, 2] = -1;

            mat[2, 1] = 7;
            mat[2, 2] = -2;
            mat[2, 3] = -4;

            mat[3, 2] = -2;
            mat[3, 3] = -1;
            mat[3, 4] = 9;

            mat[4, 3] = 5;
            mat[4, 4] = -8;

            vec[0, 0] = -1;
            vec[1, 0] = -4;
            vec[2, 0] = 0;
            vec[3, 0] = 1;
            vec[4, 0] = 2;

            LUFactorization.Solve(mat, vec);

            Console.WriteLine(vec.ToString());

            mat.Dispose();
            vec.Dispose();
        }
    }
}
